package org.crazyit.activiti_d2._7_MyCacheBean;

import org.activiti.engine.impl.persistence.deploy.DeploymentCache;

import java.util.HashMap;
import java.util.Map;

public class MyCacheBean<T> implements DeploymentCache {

    public Map<String, T> cache;

    public MyCacheBean() {
        cache = new HashMap<String, T>();
    }

    public T get(String id) {
        return cache.get(id);
    }

    public boolean contains(String id) {
        return cache.containsKey(id);
    }

    public void add(String id, Object object) {
        cache.put(id, (T) object);
    }

    public void remove(String id) {
        cache.remove(id);
    }

    public void clear() {
        cache.clear();
    }

}
